<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>


    <style>
        /* #div1{width: 100px; height: 100px; background: red; float: right;}
        #div2{width: 200px; height: 200px; background: green; clear: both;} */

        /* #div1{width: 200px; border: black solid 1px;}
        #div2{width: 100px; height: 100px; background-color: red; float: left;} */

        /* #div1{width: 200px; border: 1px solid black;}
        #div2{width: 100px; height: 200px; background: red; float: left;}
        #div3{clear: both;} */


        #div1{width: 200px; border: 1px solid black;}
        #div2{width: 100px; height: 200px; background: red; float: left;}

        /* content 添加的是内联标签，因为清除浮动对块标签起作用，所以要将内联转成块,然后在清除浮动 */
        .cl::after {
            content: ""; display: block; clear: both;
        }

    </style>
 

</head>
<body>

    <!-- <div id="div1"></div>
    <div id="div2"></div> -->
    <!-- <div id="div1">

        <div id="div2"></div>
    </div> -->

    <!-- <div id="div1">
        <div id="div2"></div>
        <div id="div3"></div>
    </div>
    撒娇撒但是 -->


    <div id="div1" class="cl">
        <div id="div2"></div>
    </div>
    
</body>
</html>